<cfcomponent extends="assets.calgrants.com.Base">

	<cfscript>
        import assets.calgrants.com.bo.FundWorkshopAppeal;
	</cfscript>
	
	<cffunction name="get" access="public" output="false" returntype="assets.calgrants.com.bo.FundWorkshopAppeal">
		<cfargument name="Fund_Workshop_Appeal_ID" type="numeric" required="true" />
		<cfscript>
			if (arguments.Fund_Workshop_Appeal_ID gt 0) {
				local.loadArgs = {};
				local.loadArgs.obj = new FundWorkshopAppeal();
				StructAppend(local.loadArgs, QueryToStruct(read(argumentCollection = arguments))[1]);
				return load(argumentCollection = local.loadArgs);
			} else {
				return new FundWorkshopAppeal();
			}
		</cfscript>
	</cffunction>
		
	<cffunction name="load" access="public" output="false" returntype="assets.calgrants.com.bo.FundWorkshopAppeal">
		<cfargument name="obj" type="assets.calgrants.com.bo.FundWorkshopAppeal" required="true" />
		<cfscript>
			local.obj = arguments.obj;
			if (IsDefined("arguments.Fund_Workshop_Appeal_ID")) {
				local.obj.setFund_Workshop_Appeal_ID(arguments.Fund_Workshop_Appeal_ID);
			}
			if (IsDefined("arguments.Deleted")) {
				local.obj.setDeleted(arguments.Deleted);
			}
			if (IsDefined("arguments.Approved")) {
				local.obj.setApproved(arguments.Approved);
			}
			if (IsDefined("arguments.Organization_ID")) {
				local.obj.setOrganization_ID(arguments.Organization_ID); 
			}
			if (IsDefined("arguments.Workshop_ID")) {
				local.obj.setWorkshop_ID(arguments.Workshop_ID);
			}
			if (IsDefined("arguments.Appealed_By_ID")) {
				local.obj.setAppealed_By_ID(arguments.Appealed_By_ID);
			}
			if (IsDefined("arguments.Appeal")) {
				local.obj.setAppeal(arguments.Appeal);
			}
			if (IsDefined("arguments.Response")) {                             
				local.obj.setResponse(arguments.Response);
			}
			if (IsDefined("arguments.Date_Created")) {
				local.obj.setDate_Created(arguments.Date_Created);
			}
			return local.obj;
		</cfscript>
	</cffunction>

	<cffunction name="read" access="public" output="false" returntype="any">
		<cfargument name="Fund_Workshop_Appeal_ID" required="false" default="" />
		<cfargument name="Deleted" required="false" default="0" />
		<cfargument name="Approved" required="false" default="" />
		<cfargument name="Organization_ID" required="false" default="" />
		<cfargument name="Workshop_ID" required="false" default="" />
		<cfargument name="Appealed_By_ID" required="false" default="" />
		<cfargument name="Appeal" required="false" default="" />
		<cfargument name="Response" required="false" default="" />
		<cfargument name="Date_Created" required="false" default="" />
		<cfargument name="fundWorkshopAppealIDs" required="false" default="" />
		<cfargument name="fundWorkshopIDs" required="false" default="" />
		<cfargument name="workshopIDs" required="false" default="" />
		<cfargument name="fundIDs" required="false" default="" />
		<cfset var recs = "">
		<cfstoredproc datasource="#getDatasource()#" procedure="readFundWorkshopAppeal">
			<cfprocparam value="#arguments.Fund_Workshop_Appeal_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Fund_Workshop_Appeal_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Deleted#" cfsqltype="CF_SQL_BIT" null="#IIf(Len(Trim(arguments.Deleted)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Approved#" cfsqltype="CF_SQL_BIT" null="#IIf(Len(Trim(arguments.Approved)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Organization_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Organization_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Workshop_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Workshop_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.Appealed_By_ID#" cfsqltype="CF_SQL_INTEGER" null="#IIf(Len(Trim(arguments.Appealed_By_ID)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.fundWorkshopAppealIDs#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.fundWorkshopAppealIDs)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.fundWorkshopIDs#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.fundWorkshopIDs)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.workshopIDs#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.workshopIDs)) eq 0, true, false)#" />
			<cfprocparam value="#arguments.fundIDs#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(arguments.fundIDs)) eq 0, true, false)#" />
			<cfprocresult name="recs" />
		</cfstoredproc>
		<cfreturn recs />
	</cffunction>
	
		<cffunction name="save" access="public" output="false" returntype="any">
		<cfargument name="fundWorkshopAppeal" required="true" type="assets.calgrants.com.bo.FundWorkshopAppeal" />
		<cfstoredproc datasource="#getDatasource()#" procedure="saveFundWorkshopAppeal">
			<cfprocparam value="#fundWorkshopAppeal.getFund_Workshop_Appeal_ID()#" cfsqltype="CF_SQL_INTEGER" variable="id" type="inout" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getDeleted()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getApproved()#" cfsqltype="CF_SQL_BIT" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getOrganization_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getWorkshop_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getAppealed_By_ID()#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getAppeal()#" cfsqltype="CF_SQL_VARCHAR" null="false" />
			<cfprocparam value="#fundWorkshopAppeal.getResponse()#" cfsqltype="CF_SQL_VARCHAR" null="#IIf(Len(Trim(fundWorkshopAppeal.getResponse())) eq 0, true, false)#" />
		</cfstoredproc>
		<cfreturn id />
	</cffunction>

	<cffunction name="destroy" access="public" output="false" returntype="any">
		<cfargument name="Fund_Workshop_Appeal_ID" required="true" />
		<cfstoredproc datasource="#getDatasource()#" procedure="destroyFundWorkshopAppeal">
			<cfprocparam value="#arguments.Fund_Workshop_Appeal_ID#" cfsqltype="CF_SQL_INTEGER" null="false" />
			<cfprocparam value="true" cfsqltype="CF_SQL_BIT" null="false" />
		</cfstoredproc>
		<cfreturn true />
	</cffunction>

</cfcomponent>

